﻿using University.Workshop.Business;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using University.Workshop.Model;
using System.Data;

namespace University.Workshop.Tests
{
    
    
    /// <summary>
    ///This is a test class for DiagnosticManagerTest and is intended
    ///to contain all DiagnosticManagerTest Unit Tests
    ///</summary>
    [TestClass()]
    public class DiagnosticManagerTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion

        private Diagnostic LoadDiagnostic()
        {
            //Random random = new Random(DateTime.Now.Millisecond);
            Diagnostic newDiagnostic = new Diagnostic();
            newDiagnostic.CIPatient = 6736789;
            newDiagnostic.CIDoctor = 6600234;            
            newDiagnostic.DateDiagnostic = DateTime.Today;
            newDiagnostic.NameDiagnostics = "Destructive Dental Pathology";
            newDiagnostic.NameTreatments = "Extractions";
            newDiagnostic.AdverseCircumstancesPatient = "Poor Hygiene";            
            newDiagnostic.Observation = "Mala Alimentacion";
            newDiagnostic.StateDiagnostic = "1";            
            return newDiagnostic;
        }

        /// <summary>
        ///A test for InsertDiagnosticPatient 
        ///</summary>
        [TestMethod()]
        public void InsertDiagnosticPatientTest()
        {
            Diagnostic diagnostic = LoadDiagnostic(); // TODO: Initialize to an appropriate value
            bool expected = true; // TODO: Initialize to an appropriate value
            bool actual;
            actual = DiagnosticManager.InsertDiagnosticPatient(diagnostic);
            Assert.AreEqual(expected, actual);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for InsertDiagnosticPatient Null
        ///</summary>
        [TestMethod()]
        public void InsertDiagnosticPatientNullTest()
        {
            Diagnostic diagnostic = null; // TODO: Initialize to an appropriate value
            bool expected = false; // TODO: Initialize to an appropriate value
            bool actual;
            actual = DiagnosticManager.InsertDiagnosticPatient(diagnostic);
            Assert.AreEqual(expected, actual);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for ObtainNunQuery
        ///</summary>
        [TestMethod()]
        public void ObtainNunQueryTest()
        {
            string expected = "0"; // TODO: Initialize to an appropriate value
            string actual;
            actual = DiagnosticManager.ObtainNunQuery();
            //Assert.AreEqual(expected, actual);
            Assert.AreNotEqual(expected, actual);
        }

        /// <summary>
        ///A test for LoadDataDiagnosticPatient
        ///</summary>
        [TestMethod()]
        public void LoadDataDiagnosticPatientTest()
        {
            string searchPatient = "6736789"; // TODO: Initialize to an appropriate value
            string expected = "State Treatment :True  Diagnostic :Destructive Dental Pathology  Treatments :Extractions  Adverse Circumstances :Poor Hygiene"; // TODO: Initialize to an appropriate value
            string actual;
            actual = DiagnosticManager.LoadDataDiagnosticPatient(searchPatient);
            Assert.AreEqual(expected, actual);
            //  Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for LoadDataDiagnosticPatient Null
        ///</summary>
        [TestMethod()]
        public void LoadDataDiagnosticNullPatientTest()
        {
            string searchPatient = string.Empty; // TODO: Initialize to an appropriate value
            string expected = null; // TODO: Initialize to an appropriate value
            string actual;
            actual = DiagnosticManager.LoadDataDiagnosticPatient(searchPatient);
            Assert.AreEqual(expected, actual);
          //  Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for LoadDataGridViewQuery
        ///</summary>
        [TestMethod()]
        public void LoadDataGridViewQueryTest()
        {
            //DataTable expected = null; // TODO: Initialize to an appropriate value
            DataTable actual;
            actual = DiagnosticManager.LoadDataGridViewQuery();
            Assert.IsTrue(actual.Rows.Count>=1);
        }

        /// <summary>
        ///A test for  NDiagnostic LoadDataGridViewSearchQuery
        ///</summary>
        [TestMethod()]
        public void LoadDataGridViewSearchQueryNDiagnosticTest()
        {
            string searchQuery = "1"; // TODO: Initialize to an appropriate value
            //DataTable expected = null; // TODO: Initialize to an appropriate value
            DataTable actual;
            actual = DiagnosticManager.LoadDataGridViewSearchQuery(searchQuery);
            Assert.IsTrue(actual.Rows.Count>=1);
        }

        /// <summary>
        ///A test for  Date Diagnostic LoadDataGridViewSearchQuery
        ///</summary>
        [TestMethod()]
        public void LoadDataGridViewSearchQueryDateDiagnosticTest()
        {
            string searchQuery = "04/04/2012"; // TODO: Initialize to an appropriate value
            //DataTable expected = null; // TODO: Initialize to an appropriate value
            DataTable actual;
            actual = DiagnosticManager.LoadDataGridViewSearchQuery(searchQuery);
            Assert.IsTrue(actual.Rows.Count >= 1);
        }

        /// <summary>
        ///A test for  null LoadDataGridViewSearchQuery
        ///</summary>
        [TestMethod()]
        public void LoadDataGridViewSearchQueryNullTest()
        {
            string searchQuery = "nada"; // TODO: Initialize to an appropriate value
            DataTable expected = null; // TODO: Initialize to an appropriate value
            DataTable actual;
            actual = DiagnosticManager.LoadDataGridViewSearchQuery(searchQuery);
            Assert.AreEqual(expected,actual);            
        }
    }
}
